<?php

$mblog_performance_wapi_called_count = array();
define("REQUEST_DEMAIN","http://mblogv2.city.sina.com.cn/interface/common/json_get_page_to_json.php?passcode");

class mod_get_mblog_from_json 
{
	public $api_debug = false;
	
	function mod_get_mblog_from_json($app_id=0)
	{
		
		$app_id = 444550;
		
		switch ($app_id)
		{
			//这里请修改成各站自己的appkey,如果不清楚联系 杨超（15801014145）

			case 444550:
			$this->app_key = "a3a25af64072e78a8e0dda1562e24a0e";
			$this->app_secret = "71a2409f3b08a315940805a9065c9fd8";
			$this->app_id = "444550";
			break;
			
			default;
       	 	$this->app_key = "a3a25af64072e78a8e0dda1562e24a0e";
			$this->app_secret = "71a2409f3b08a315940805a9065c9fd8";
			$this->app_id = "444550";
   		 	break;

		}
		
		if(isset($_GET["api_debug"]))
		{
			$this->api_debug = true;
		}
		else
		{
			$this->api_debug = false;
		}
	}
	
	
		
	function mblog_curl_request($api_url, $submit_ary, $debug)
	{
		global $program_wapi_call_time;
		$content = network::curl_submit_no_encode($api_url, $submit_ary,  $this->api_debug);
		return $content;
	}
	

	
	function api_add_private_message($appkey="",$token="",$uid,$text)
	{
		$api_url = "http://i2.api.weibo.com/2/direct_messages/new.json?source={$appkey}&access_token={$token}";
		$request_url = REQUEST_DEMAIN."&url=".urlencode($api_url)."&type=post";
		$params_arr["text"] = $text;
		$params_arr["uid"] = $uid;
		$submit_ary["params_arr"] = serialize($params_arr);
		$content = $this->mblog_curl_request($request_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}

	
	function api_get_new_private_message($appkey="",$token="",$since_id=0 ,$max_id=0 ,$count=200 ,$page=1)
	{
		$api_url = "http://i2.api.weibo.com/2/direct_messages.json?source={$appkey}&access_token={$token}";
		$params_arr["since_id"] = $since_id;
		$params_arr["max_id"] = $max_id;
		$params_arr["count"] = $count;
		$params_arr["page"] = $page;
		if($params_arr)
		{
			$api_url = $api_url."&".http_build_query($params_arr,"","&");
		}
		
		
		$request_url = REQUEST_DEMAIN."&url=".urlencode($api_url)."&type=get";
		
		
		if(isset($_GET["api_debug"]))
		{
			echo "<!--$request_url -->";
		}
		$content = file_get_contents($request_url);
		
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		
		return $content;
	}
	
	
	

	/*微博评论列表
	mid 	true 	int64 	微博ID。
	since_id 	false 	int64 	若指定此参数，则只返回ID比since_id大的微博消息（即比since_id发表时间晚的微博消息）。默认为0
	max_id 	false 	int64 	若指定此参数，则返回ID小于或等于max_id的微博消息。默认为0
	count 	false 	int 	返回结果条数数量，默认50
	page 	false 	int 	指定返回结果的页码。
	filter_by_author 	false 	int 	筛选类型ID（0：全部，1：我关注的人，2：陌生人，3：v用户）默认为0、
	need_link 	false 	int 	需要替换话题，表情，@用户连接 赋值 1、
	*/
	function api_get_comment_by_mid($mid,$p=1,$pcount=10,$filter_by_author=0,$since_id=0,$max_id=0,$site_id=908,$need_link=0)
	{

		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/comment/api_get_comment_by_mid.php";
		$submit_ary["mid"] = $mid;
		$submit_ary["pcount"] = $pcount;
		$submit_ary["filter_by_author"] = $filter_by_author;
		$submit_ary["p"] = $p;
		$submit_ary["since_id"] = $since_id;
		$submit_ary["max_id"] = $max_id;
		$submit_ary["need_link"] = $need_link;
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
		
	
	

	function api_get_mblog_by_uids_and_search($key="",$uids="",$start="",$num="",$isred="",$zone="",$startime="",$endtime="",
		$hasori="",
		$hasret="",
		$hastext="",
		$haspic="",
		$hasvideo="",
		$hasmusic="",
		$haslink="",
		$hasat="",
		$istag="",
		$nofilter="",
		$onlymid="",
		$site_id
	)
	{
	
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/mblog/api_get_mblog_by_uids_and_search.php";
		
		$submit_ary["ip_debug"] = 1;
		
		$submit_ary["uids"] = $uids;
		$submit_ary["key"] = $key;
	
		$submit_ary["start"] = $start;
		$submit_ary["num"] = $num;
		$submit_ary["isred"] = $isred;
		
		$submit_ary["zone"] = $zone;
		$submit_ary["startime"] = $starttime;
		$submit_ary["endtime"] = $endtime;
		$submit_ary["haspic"] = $haspic;
		$submit_ary["haslink"] = $$haslink;
		$submit_ary["hasori"] = $hasori;
		$submit_ary["hasret"] = $hasret;
		$submit_ary["hasat"] = $hasat;
		$submit_ary["hasvideo"] = $hasvideo;
		$submit_ary["hasmusic"] = $hasmusic;
		$submit_ary["hastext"] = $hastext;
		$submit_ary["nofilter"] = $nofilter;
		$submit_ary["istag"] = $istag;
		$submit_ary["onlymid"] = $onlymid;
		
		
		$submit_ary["lan"] = "utf8";
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	
	/*
	 * 	微薄转发ID列表
	 * id 	true 	int64 	需要查询的微博ID。
	since_id 	false 	int64 	若指定此参数，则返回ID比since_id大的微博（即比since_id时间晚的微博），默认为0。
	max_id 	false 	int64 	若指定此参数，则返回ID小于或等于max_id的微博，默认为0。
	count 	false 	int 	单页返回的记录条数，默认为50。
	page 	false 	int 	返回结果的页码，默认为1。
	filter_by_author 	false 	int 	作者筛选类型，0：全部、1：我关注的人、2：陌生人，默认为0。 
	*/
	function api_get_rt_ids_by_mid($mid,$since_id,$max_id,$p,$pcount,$filter_by_author="",$site_id=908)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/comment/api_get_rt_ids_by_mid.php";
		$submit_ary["mid"] = $mid;
		$submit_ary["pcount"] = $pcount;
		$submit_ary["filter_by_author"] = $filter_by_author;
		$submit_ary["p"] = $p;
		$submit_ary["since_id"] = $since_id;
		$submit_ary["max_id"] = $max_id;
		$submit_ary["recache"] = 1;
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	/**
	 * 批量获取微博内容
	必选 	类型 	说明
	ids 	true 	int64 	根据指定id返回微博的相应内容。一次最多50个。
	trim_user 	false 	int 	status中的user信息开关，trim_user为1时，tatus中的user字段仅返回user_id，trim_user为0时返回完整user信息。默认trim_user为0
	need_link 	false 	int 	需要替换话题，表情，@用户连接 赋值 1、
	 */
	function api_get_mblog_by_mids($mids,$trim_user=0,$site_id=90,$need_link=0)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/mblog/api_get_mblog_by_mids.php";
		$submit_ary["mids"] = $mids;
		$submit_ary["trim_user"] = $trim_user;
		
		$submit_ary["need_link"] = $need_link;
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	/**  微博搜索接口
		q 	false 	string 	搜索的关键字。必须进行URLencode，utf-8编码。
		uid 	false 	int64 	搜某用户的微博，参数q为空表示搜索这个用户的所有微博。
		ids 	false 	string 	搜索指定批量用户的微博，传用户UID，多个用~分隔，最多不超过2000，按时间排序，与uid参数取交集。
		sort 	false 	string 	排序方式，time：时间倒序、social：社会化排序、hot：热门度、fwnum：按转发数倒序、cmtnum：评论数倒序，默认为time。
		province 	false 	int 	搜索的省份ID，参考省份城市编码表，参数q为空表示搜索这个省份的所有微博。
		city 	false 	int 	搜索的城市ID，参考省份城市编码表，参数q为空表示搜索这个城市的所有微博。
		starttime 	false 	int64 	搜索范围起始时间，取值为时间戳。
		endtime 	false 	int64 	搜索范围结束时间，取值为时间戳。
		hasori 	false 	int 	是否包含原创，0：否、1：是，默认为空（全部）。
		hasret 	false 	int 	是否包含转发，0：否、1：是，默认为空（全部）。
		hastext 	false 	int 	是否为纯文本，0：否、1：是，默认为空（全部）。
		haspic 	false 	int 	是否包含图片，0：否、1：是，默认为空（全部）。
		hasvideo 	false 	int 	是否包含视频，0：否、1：是，默认为空（全部）。
		hasmusic 	false 	int 	是否包含音乐，0：否、1：是，默认为空（全部）。
		haslink 	false 	int 	是否包含链接，0：否、1：是，默认为空（全部）。
		hasat 	false 	int 	是否包含@，0：否、1：是，默认为空（全部）。
		hasv 	false 	int 	是否为v用户发言，0：否、1：是，默认为空（全部）。
		istag 	false 	int 	是否为搜##内的话题，0：否、1：模糊匹配、2：精确匹配，默认为0。
		onlynum 	false 	int 	是否只返回总数，0：否、1：是，默认为0。
		dup 	false 	int 	是否排重（不显示相似数据），0：否、1：是，默认为1。
		antispam 	false 	int 	是否反垃圾（不显示低质量数据），0：否、1：是，默认为1。
		p 	false 	int 	页码，默认为1，最多输出1000条结果。
		pcount 	false 	int 	每页返回的数量，默认10，最大50。（默认返回10条）
		base_app 	false 	int 	是否只获取当前应用的数据。0为否（所有数据），1为是（仅当前应用），默认为0。
		need_link 	false 	int 	需要替换话题，表情，@用户连接 赋值 1、
	 * @param $topic
	 */
	function api_get_mblog_by_topic($topic="",$ids="",$sort="",$fuid="",$province="",$city="",$starttime="",$endtime="",
	$hasori="",
	$hasret="",
	$hastext="",
	$haspic="",
	$hasvideo="",
	$hasmusic="",
	$haslink="",
	$hasat="",
	$hasv="",
	$istag="",
	$dup="",
	$antispam="",
	$base_app=0,
	$p=1,
	$pcount=10,
	$site_id="",
	$need_link=0)
	{
	
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/mblog/api_get_mblog_by_topic.php";
		
		$submit_ary["topic"] = $topic;
		$submit_ary["ids"] = $ids;	
		$submit_ary["sort"] = $sort;
		$submit_ary["fuid"] = $fuid;
		$submit_ary["province"] = $province;
		$submit_ary["city"] = $city;
		$submit_ary["starttime"] = $starttime;
		$submit_ary["endtime"] = $endtime;
		
		$submit_ary["hasori"] = $hasori;
		$submit_ary["hasret"] = $hasret;
		$submit_ary["hastext"] = $hastext;
		$submit_ary["haspic"] = $haspic;
		$submit_ary["hasvideo"] = $hasvideo;
		$submit_ary["hasmusic"] = $hasmusic;
		$submit_ary["haslink"] = $haslink;
		$submit_ary["hasat"] = $hasat;
		$submit_ary["hasv"] = $hasv;
		$submit_ary["istag"] = $istag;
		$submit_ary["dup"] = $dup;
		$submit_ary["antispam"] = $antispam;
	
		
		$submit_ary["base_app"] = $base_app;
		$submit_ary["p"] = $p;
		$submit_ary["pcount"] = $pcount;
		$submit_ary["need_link"] = $need_link;
		
		$submit_ary["lan"] = "utf8";
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}

	/** 根据uid或者昵称获取微博列表
		uid 	false 	int64 	需要查询的用户ID。
		screen_name 	false 	string 	需要查询的用户昵称。
		since_id 	false 	int64 	若指定此参数，则返回ID比since_id大的微博（即比since_id时间晚的微博），默认为0。
		max_id 	false 	int64 	若指定此参数，则返回ID小于或等于max_id的微博，默认为0。
		count 	false 	int 	单页返回的记录条数，默认为50。
		page 	false 	int 	返回结果的页码，默认为1。
		base_app 	false 	int 	是否只获取当前应用的数据。0为否（所有数据），1为是（仅当前应用），默认为0。
		feature 	false 	int 	过滤类型ID，0：全部、1：原创、2：图片、3：视频、4：音乐，默认为0。
		trim_user 	false 	int 	返回值中user信息开关，0：返回完整的user信息、1：user字段仅返回user_id，默认为0。
		need_link 	false 	int 	需要替换话题，表情，@用户连接 赋值 1、
	 */
	function api_get_mblog_by_uid($uid,$screen_name="",$since_id=0,$max_id=0,$p=1,$pcount=10,$base_app=0,$feature=0,$trim_user=0,$site_id,$need_link=0)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/mblog/api_get_mblog_by_uid.php";
		
		$submit_ary["need_link"] = $need_link;
		$submit_ary["uid"] = $uid;
		$submit_ary["screen_name"] = $screen_name;	
		$submit_ary["since_id"] = $since_id;
		$submit_ary["max_id"] = $max_id;
		$submit_ary["feature"] = $feature;
		$submit_ary["trim_user"] = $trim_user;
		$submit_ary["base_app"] = $base_app;
		$submit_ary["p"] = $p;
		$submit_ary["pcount"] = $pcount;
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	/**
	 * 批量取用户微博
	 *	count 	false 	integer 	返回结果条数数量，默认20默认为20
		page 	false 	integer 	指定返回结果的页码。根据所指定的用户的微博数，翻页功能最多能查看的总记录数会有所不同，通常最多能查看1000条左右。默认为1
		base_app 	false 	string 	是否进获取当前应用发布的消息。0为所有结果，1为仅当前应用。
		feature 	false 	integer 	过滤类型ID （0：全部、1：原创、2：图片、3：视频、4：音乐）默认为0
		uids 	false 	string 	用户ID。最多20个。
		screen_names 	false 	string 	微博昵称。需要URLEncode，采用UTF-8编码
		need_link 	false 	int 	需要替换话题，表情，@用户连接 赋值 1、
	 */
	function api_get_mblog_by_uids($uids,$screen_names="",$p=1,$pcount=10,$base_app=0,$feature=0,$site_id,$need_link=0)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/mblog/api_get_mblog_by_uids.php";
		
		$submit_ary["uids"] = $uids;
		$submit_ary["screen_names"] = $screen_names;	
		$submit_ary["feature"] = $feature;
		$submit_ary["base_app"] = $base_app;
		$submit_ary["p"] = $p;
		$submit_ary["pcount"] = $pcount;
		$submit_ary["need_link"] = $need_link;
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	
	/**
	 * 微博转发评论数
	 */
	function api_get_mblog_counts_by_mids($mids,$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/mblog/api_get_mblog_counts_by_mids.php";
		
		$submit_ary["mids"] = $mids;
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	//表情
	/**
	 * type      表情类别。"face":普通表情，"ani"：魔法表情，"cartoon"：动漫表情 默认为face  
	*	language      语言类别，"cnname"简体，"twname"繁体"默认为cnname  
	*/
	function api_get_mblog_emotions($type="face",$language="cnname",$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/mblog/api_get_mblog_emotions.php";
		
		$submit_ary["type"] = $type;
		$submit_ary["language"] = $language;
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	/* 用户tags
	 * uid 	false 	int64 	用户ID
	*	pcount 	false 	int 	用户每页返回的最大记录数，默认为20。
	*	p 	false 	int 	返回结果页码。默认为1，
	 */
	function api_get_user_tags_by_uid($uid,$p=1,$pcount=10,$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/user/api_get_user_tags_by_uid.php";
	
		$submit_ary["uid"] = $uid;
		$submit_ary["p"] = $p;
		$submit_ary["pcount"] = $pcount;
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	
	/* 用户粉丝列表
	 * uid 	false 	int64 	用户ID
		screen_name 	false 	string 	用户昵称
		cursor 	false 	int 	用户用于分页请求，请求第1页cursor传-1，在返回的结果中会得到next_cursor字段，表示下一页的cursor。next_cursor为0表示已经到记录末尾。
		count 	false 	int 	用户每页返回的最大记录数，最大不能超过200，默认为50。
		page 	false 	int 	返回结果页码。默认为1，cursor有值时，此参数不起作用。
		real_load 	false 	int 	标识粉丝数、关注数、微博数是否实时加载。0：不加载；1：加载，默认是0
		trim_status 	false 	int 	user中的status信息开关，trim_status为1时，user中的status字段仅返回id，trim_status为0时返回完整status信息。默认trim_status为1。
	 */
	function api_get_user_followers_by_uid($uid="",$screen_name="",$p=1,$pcount=10,$cursor=0,$real_load=0,$trim_status=0,$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/user/api_get_user_followers_by_uid.php";
	
		$submit_ary["uid"] = $uid;
		$submit_ary["screen_name"] = $screen_name;	
		$submit_ary["cursor"] = $cursor;
		$submit_ary["real_load"] = $real_load;
		$submit_ary["trim_status"] = $trim_status;
		$submit_ary["p"] = $p;
		$submit_ary["pcount"] = $pcount;
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	
	/* 用户粉丝uids列表
	 * uid 	false 	int64 	用户ID
	* 	screen_name 	false 	string 	用户昵称
	* 	cursor 	false 	int 	用户用于分页请求，请求第1页cursor传-1，在返回的结果中会得到next_cursor字段，表示下一页的cursor。next_cursor为0表示已经到记录末尾。
	* 	count 	false 	int 	用户每页返回的最大记录数，最大不能超过5000，默认为5000。
	*/
	function api_get_user_followers_ids_by_uid($uid="",$screen_name="",$p=1,$pcount=10,$cursor=0,$real_load=0,$trim_status=0,$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/user/api_get_user_followers_ids_by_uid.php";
	
		$submit_ary["uid"] = $uid;
		$submit_ary["screen_name"] = $screen_name;	
		$submit_ary["cursor"] = $cursor;
		$submit_ary["pcount"] = $pcount;
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	
	function api_get_user_followers_active_by_uid($uid,$pcount=10,$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/user/api_get_user_followers_active_by_uid.php";
	
		$submit_ary["uid"] = $uid;
		$submit_ary["pcount"] = $pcount;
		$submit_ary["ip_debug"] = $pcount;
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	
	
	/**
	 *  用户关注列表
		uid 	false 	int64 	用户ID，主要是用来区分用户ID跟微博昵称。当微博昵称为数字导致和用户ID产生歧义，特别是当微博昵称和用户ID一样的时候，建议使用该参数
		screen_name 	false 	string 	微博昵称，主要是用来区分用户UID跟微博昵称，当二者一样而产生歧义的时候，建议使用该参数
		cursor 	false 	int 	用于分页请求，请求第1页cursor传-1，在返回的结果中会得到next_cursor字段，表示下一页的cursor。next_cursor为0表示已经到记录末尾。
		count 	false 	int 	每页返回的最大记录数，最大不能超过200，默认为50。
		page 	false 	int 	返回结果页码。默认为1，cursor有值时，此参数不起作用。
		verified_type 	false 	int 	认证类型过滤。默认为全部。
		real_load 	false 	int 	标识粉丝数、关注数、微博数是否实时加载。0：不加载；1：加载，默认是0
		trim_status 	false 	int 	user中的status信息开关，trim_status为1时，user中的status字段仅返回id，trim_status为0时返回完整status信息。默认trim_status为1。
	 */
	function api_get_user_friends_by_uid($uid="",$screen_name="",$p=1,$pcount=10,$cursor=0,$real_load=0,$trim_status=0,$verified_type=0,$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/user/api_get_user_friends_by_uid.php";
	
		$submit_ary["uid"] = $uid;
		$submit_ary["screen_name"] = $screen_name;	
		$submit_ary["cursor"] = $cursor;
		$submit_ary["real_load"] = $real_load;
		$submit_ary["trim_status"] = $trim_status;
		$submit_ary["verified_type"] = $verified_type;
		$submit_ary["p"] = $p;
		$submit_ary["pcount"] = $pcount;
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	/**获取互粉列表
		uid 	true 	int64 	需要获取双向关注列表的用户ID
		pcount 	false 	int 	返回结果条数数量，默认50
		p 	false 	int 	返回结果的页码
		start_time 	false 	long 	某时间段的起始时刻，取值为时间戳
		end_time 	false 	long 	某时间段的终止时刻，取值为时间戳 
	 */
	function api_get_user_bilateral_by_uid($uid="",$p=1,$pcount=10,$start_time=0,$end_time=0,$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/user/api_get_user_bilateral_by_uid.php";
	
		$submit_ary["uid"] = $uid;
		$submit_ary["start_time"] = $start_time;
		$submit_ary["end_time"] = $end_time;
		$submit_ary["p"] = $p;
		$submit_ary["pcount"] = $pcount;
		;
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$submit_ary["recache"] = 1;							// add by dongping 2012-04-16 互粉调用不多，为去掉mblogv2.henan的缓存，直接recache
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	
	/**获取互粉UID列表
		uid 	true 	int64 	需要获取双向关注列表的用户ID
		pcount 	false 	int 	返回结果条数数量，默认2000
		p 	false 	int 	返回结果的页码
		start_time 	false 	long 	某时间段的起始时刻，取值为时间戳
		end_time 	false 	long 	某时间段的终止时刻，取值为时间戳 
	 */
	function api_get_user_bilateral_ids_by_uid($uid="",$p=1,$pcount=2000,$start_time=0,$end_time=0,$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/user/api_get_user_bilateral_ids_by_uid.php";
	
		$submit_ary["uid"] = $uid;
		$submit_ary["start_time"] = $start_time;
		$submit_ary["end_time"] = $end_time;
		$submit_ary["p"] = $p;
		$submit_ary["pcount"] = $pcount;

		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	
	/** 两个用户的关系
		source_id 	false 	int64 	源用户ID
		source_screen_name 	false 	string 	源用户昵称
		target_id 	false 	int64 	目标用户ID
		target_screen_name 	false 	string 	目标用户昵称 
	 */
	function api_get_user_friendships($source_id="",$target_id="",$source_screen_name="",$target_screen_name="",$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/user/api_get_user_friendships.php";
		
		$submit_ary["source_id"] = $source_id;
		$submit_ary["source_screen_name"] = $source_screen_name;	
		$submit_ary["target_id"] = $target_id;
		$submit_ary["target_screen_name"] = $target_screen_name;
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	/* 取用户单条(用户不存在能报错)
	 * 	uid 	false 	int64 	用户ID
	* 	screen_name 	false 	string 	用户昵称
	* 	has_extend 	false 	int 	是否有扩展信息，0：否，1：是。默认1.此参数仅对内部接口有效。
	*/
	function api_get_user_info_by_uid($uid="",$screen_name="",$has_extend=0,$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/user/api_get_user_info_by_uid.php";
		
		$submit_ary["uid"] = $uid;
		$submit_ary["screen_name"] = $screen_name;	
		$submit_ary["has_extend"] = $has_extend;
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	/**
	 * 通过个性化域名获取用户资料以及用户最新的一条微博
	 * domain 	true 	string 	需要查询的个性化域名
	 */
	function api_get_user_info_by_domain($domain,$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/user/api_get_user_info_by_domain.php";
		
		$submit_ary["domain"] = $domain;
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	
	/* 批量取用户
	 * 	uids 	false 	int64 	用户ID，一次最多20个
		screen_name 	false 	string 	用户昵称，一次最多20个
		trim_status 	false 	int 	user中的status信息开关，trim_status为1时，user中的status字段仅返回status_id，trim_status为0时返回完整status信息。默认trim_status为0。
		has_extend 	false 	int 	是否有扩展信息，0：否，1：是。默认0.此参数仅对内部接口有效。
	*/
	
	function api_get_user_info_by_uids($uids="",$screen_name="",$trim_status=0,$has_extend=0,$recache=false)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/user/api_get_user_info_by_uids.php";
		
		$submit_ary["uids"] = $uids;
		$submit_ary["screen_name"] = $screen_name;	
		$submit_ary["trim_status"] = $trim_status;
		$submit_ary["has_extend"] = $has_extend;
		$submit_ary["force_api"] = 1;
		if($recache)$submit_ary["recache"] = 1;
		
		$submit_ary["site_id"] = 900;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		
		
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	
	/*
	 * 将一个或多个长链接转换成短链接 
	 * urls 	true 	string 	需要转换的长链接，需要URLencoded，最多不超过20个 使用,隔开。 
	 */
	function api_url_to_short($urls,$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/url/api_url_to_short.php";
		
		$submit_ary["urls"] = $urls;
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	/*
	 * 获取短链内容
	 * urls 	true 	string 	需要转换的长链接，需要URLencoded，最多不超过20个 使用,隔开。 
	 */
	function api_short_url_info($urls,$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/url/api_short_url_info.php";
		
		$submit_ary["urls"] = $urls;
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	/*
	 * 根据坐标返回地址信息的接口 
	 * $coordinate true 	float 	需要获取信息的坐标 
	 */
	function api_geo_to_address($coordinate,$site_id="")
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/map/api_geo_to_address.php";
		
		$submit_ary["coordinate"] = $coordinate;
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	
		function api_get_user_by_search(
		$q="",
		$nick="",
		$qq="", 
		$tags="",
		$province="",
		$city="",
		$gender="",
		$isv="",
		$ip="",
		$sbirth="",
		$ebirth="",
		$comp="",
		$scho="",
		$sort="",
		$page="",
		$count=""
	)
	{
	
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/user/api_get_user_by_search.php";
		
		$submit_ary["ip_debug"] = 1;
		
		$submit_ary["q"] = "$q";
		$submit_ary["nick"] = "$nick";
		$submit_ary["qq"] = "$qq";
		$submit_ary["tags"] = "$tags";
		$submit_ary["province"] = "$province";
		$submit_ary["city"] = "$city";
		$submit_ary["gender"] = "$gender";
		$submit_ary["isv"] = "$isv";
		$submit_ary["ip"] = "$ip";
		$submit_ary["sbirth"] = "$sbirth";
		$submit_ary["ebirth"] = "$ebirth";
		$submit_ary["comp"] = "$comp";
		$submit_ary["scho"] = "$scho";
		
		$submit_ary["sort"] = "$sort";
		$submit_ary["p"] = "$page";
		$submit_ary["pcount"] = "$count";
		
		$submit_ary["lan"] = "utf8";
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	
	
	
########################共有接口结束


########################私有接口

	/** 获取最新的提到登录用户的微博列表，即@我的微博  
	 * 需要这个uid已经激活过key(激活地址,以当前用户身份激活 ：http://mblogv2.city.sina.com.cn/token/)
		since_id 	false 	int64 	若指定此参数，则返回ID比since_id大的微博（即比since_id时间晚的微博），默认为0。
		max_id 	false 	int64 	若指定此参数，则返回ID小于或等于max_id的微博，默认为0。
		count 	false 	int 	单页返回的记录条数，默认为50。
		page 	false 	int 	返回结果的页码，默认为1。
		filter_by_author 	false 	int 	作者筛选类型，0：全部、1：我关注的人、2：陌生人，默认为0。
		filter_by_source 	false 	int 	来源筛选类型，0：全部、1：来自微博、2：来自微群，默认为0。
		filter_by_type 	false 	int 	原创筛选类型，0：全部微博、1：原创的微博，默认为0。 
	 */
	function api_mentions_list($uid="",$since_id=0,$max_id=0,$p=1,$pcount=10,$filter_by_author=0,$filter_by_source=0,$filter_by_type=0,$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/o_auth/privatemessage/api_mentions_list.php";
		
		$submit_ary["uid"] = $uid;
		$submit_ary["since_id"] = $since_id;	
		$submit_ary["max_id"] = $max_id;
		$submit_ary["p"] = $p;
		$submit_ary["pcount"] = $pcount;
		$submit_ary["filter_by_author"] = $filter_by_author;
		$submit_ary["filter_by_source"] = $filter_by_source;
		$submit_ary["filter_by_type"] = $filter_by_type;
		
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
		
	
	
	/** api接口发微博,需要这个uid已经激活过key(激活地址,以当前用户身份激活 ：http://mblogv2.city.sina.com.cn/token/) 
		uid 	true 	int64 	需要发微博的uid
		content 	true 	内容
		pid 	false 	int 图片id()。
		$pic_url 	false 	int 	远程图片地址。
		piccontent 	false 	int 	图片数据流
		app_name 	false 	int 	允许定制来源的appkey才可用
		app_url 	false 	int 	允许定制来源的appkey才可用
	 */
	function api_add_mblog($uid,$content,$pid="",$pic_url="",$piccontent="",$app_name="",$app_url="",$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/o_auth/postaction/api_add_mblog.php";
		
		$submit_ary["uid"] = $uid;
		$submit_ary["content"] = $content;	
		$submit_ary["pid"] = $pid;
		$submit_ary["pic_url"] = $pic_url;
		$submit_ary["piccontent"] = $piccontent;
		$submit_ary["app_name"] = $app_name;
		$submit_ary["app_url"] = $app_url;
	
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
		/**
	 * 发送系统通知
	 *  owner_id 当前appkey拥有者uid
	 * uids 	true 	string 	接收通知的用户UID，支持1-100个用户，用逗号分隔。
	*	tpl_id 	true 	int 	发送通知所对应的模版ID，必须是通过审核，且启用中的模版。
	*	objects1 	false 	string 	状态变更的自定义变量1，可以是人也可以是系统实物，支持@用户昵称，最多不超过32个字节。
	*	objects1_count 	false 	int 	状态变更自定义变量1的数量，正整数，最多不超过2个字节，支持0-99。
	*	objects2 	false 	string 	状态变更的自定义变量2，可以是人也可以是系统实物，支持@用户昵称，最多不超过32个字节。
	*	objects2_count 	false 	int 	状态变更自定义变量2的数量，正整数，最多不超过2个字节，支持0-99。
	*	objects3 	false 	string 	状态变更的自定义变量3，可以是人也可以是系统实物，支持@用户昵称，最多不超过32个字节。
	*	objects3_count 	false 	int 	状态变更自定义变量3的数量，正整数，最多不超过2个字节，支持0-99。
	*	action_url 	false 	string 	状态变更处理链接，支持短链接，最多不超过20个字节。 
	 */
	
	function api_add_notice($owner_id,$uids,$tpl_id,$action_url,$objects1,$objects1_count,$objects2,$objects2_count,$objects3,$objects3_count)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/o_auth/postaction/api_add_notice.php";
		
		$submit_ary["owner_id"] = $owner_id;
		$submit_ary["uids"] = $uids;	
		$submit_ary["tpl_id"] = $tpl_id;
		$submit_ary["action_url"] = $action_url;
		
		$submit_ary["objects1"] = $objects1;
		$submit_ary["objects1_count"] = $objects1_count;
		$submit_ary["objects2"] = $objects2;
		$submit_ary["objects2_count"] = $objects2_count;
		$submit_ary["objects3"] = $objects3;
		$submit_ary["objects3_count"] = $objects3_count;
		
		$submit_ary["site_id"] = $site_id;					// WARRNG BY DONGPING
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	
	
	function api_upload_pic($piccontent,$pic_url="")
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/mblog/api_upload_pic.php";
	
		$submit_ary["ip_debug"] = 1;
		$submit_ary["content"] = $content;	
		$submit_ary["pic_url"] = $pic_url;
		$submit_ary["piccontent"] = $piccontent;//需要base64_encode
	
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
########################私有接口结束

	
########################发送cookie调用接口
	//获取当前用户cookie
	function get_current_cookie_list()
	{
		if(!$_COOKIE["SUE"] || !$_COOKIE["SUP"] ) 
		{
			return false;
		}
		return "SUE=".urlencode($_COOKIE["SUE"])."; SUP=".urlencode($_COOKIE["SUP"]);	
	}
	
	//根据当前用户cookie发微博
	function api_add_mblog_call_with_cookie($content,$pid="",$pic_url="",$piccontent="",$app_name="",$app_url="",$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/cookie_auth/postaction/api_add_mblog.php";
		
		$submit_ary["cookie_list"] = $this->get_current_cookie_list();
		$submit_ary["content"] = $content;	
		$submit_ary["pid"] = $pid;
		$submit_ary["pic_url"] = $pic_url;
		$submit_ary["piccontent"] = $piccontent;//需要base64_encode
		
		$user_global_config =  user_global_config::get_instance();
		
		$app_name = $user_global_config->get_current_site_name();
		$submit_ary["app_name"] = $app_name;
		$demain = $user_global_config->get_current_domain();
		$app_url = "http://".$demain;//当前站点对应的域名为准
		$submit_ary["app_url"] = $app_url;
	
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	

	/**
	 * 根据当前用户cookie发评论
		comment 	true 	string 	评论内容。必须做URLEncode,信息内容不超过140个汉字。
		id 	true 	int64 	微博ID。
		comment_ori 	false 	int 	当回复一条转发微博的评论时，是否评论给原微博。0:不评论给原微博。1：评论给原微博。默认0.
		 */
	function api_add_comment_call_with_cookie($comment,$mid="",$comment_ori="",$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/cookie_auth/postaction/api_add_comment.php";
		
		$submit_ary["cookie_list"] = $this->get_current_cookie_list();
		$submit_ary["comment"] = $comment;	
		$submit_ary["mid"] = $mid;
		$submit_ary["comment_ori"] = $comment_ori;
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	
	//根据当前用户cookie获取推荐关注用户，pcount最大20
	function api_guess_user_like_call_with_cookie($p=1,$pcount=10,$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/cookie_auth/sug/api_guess_user_like.php";
		
		
		$submit_ary["ip_debug"] = 1;
		$submit_ary["cookie_list"] = $this->get_current_cookie_list();
		
		$submit_ary["p"] = $p;
		$submit_ary["pcount"] = $pcount;
	
		
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	
	
########################发送cookie调用结束

	
	//添加一用户授权
	function api_add_user_token($uid,$appkey,$access_token,$expires_in,$refresh_token,$remind_in,$version)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/common/api_add_user_token.php";
		
		$submit_ary["uid"] = $uid;
		$submit_ary["appkey"] = $appkey;
		$submit_ary["access_token"] = $access_token;
		$submit_ary["expires_in"] = $expires_in;
		$submit_ary["refresh_token"] = $refresh_token;
		$submit_ary["remind_in"] = $remind_in;
		$submit_ary["version"] = $version;
		
		
		global $config;
		$submit_ary["site_id"] = $config["current_site_id"];
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	function api_get_user_token($uid,$appkey,$version,$p=1,$pcount=10)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/common/api_get_user_token.php";
		
		$submit_ary["uid"] = $uid;
		$submit_ary["appkey"] = $appkey;
		$submit_ary["version"] = $version;
		$submit_ary["p"] = $p;
		$submit_ary["pcount"] = $pcount;
		
		global $config;
		$submit_ary["site_id"] = $config["current_site_id"];
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	
	
	function api_get_education_by_uids($uids,$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/user/api_get_education_by_uids.php";
		
		$submit_ary["uids"] = $uids;
		$submit_ary["ip_debug"] = 1;
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	 
	
	function api_get_user_age_by_uids($uids,$site_id)
	{
		$api_url = MBLOGV2_DEMAIN."/api/tcommonv2/no_auth/user/api_get_user_age_by_uids.php";
		
		$submit_ary["uids"] = $uids;
		$submit_ary["ip_debug"] = 1;
		$submit_ary["site_id"] = $site_id;
		$submit_ary["t"] = "json";
		$submit_ary["app_key"] = $this->app_key;
		$submit_ary["app_secret"] = $this->app_secret;
		$submit_ary["app_id"] = $this->app_id;
		$content = $this->mblog_curl_request($api_url, $submit_ary,  $this->api_debug);
		$content = json_decode($content,true);
		if($this->api_debug)
		{
			print_r($content);
		}
		return $content;
	}
	
	
}
